home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWHashDictionary - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss typedef RWHashDictionary Dictionary; // Smalltalk typedef. #include <rw/hashdict.h> RWHashDictionary a ; DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn An RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy represents a group of unordered values, accessible by external keys. Duplicate keys are not allowed. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy is implemented as a hash table of associations of keys and values. Both the key and the value must inherit from the abstract base class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee, with a suitable definition of the virtual function hhhhaaaasssshhhh(((()))) and iiiissssEEEEqqqquuuuaaaallll(((()))) for the key. TTTThhhhiiiissss ccccllllaaaassssssss ccccoooorrrrrrrreeeessssppppoooonnnnddddssss ttttoooo tttthhhheeee SSSSmmmmaaaallllllllttttaaaallllkkkk ccccllllaaaassssssss DDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy.... PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy(size_t n = RWDEFAULT_CAPACITY); Construct an empty hashed dictionary using nnnn hashing buckets. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy(const RWHashDictionary& hd); Copy constructor. A shallow copy of the collection hhhhdddd is made. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss void ooooppppeeeerrrraaaattttoooorrrr====(const RWHashDictionary& hd); Assignment operator. A shallow copy of the collection hhhhdddd is made. RWBoolean ooooppppeeeerrrraaaattttoooorrrr<<<<====(const RWHashDictionary& hd) const; Returns TTTTRRRRUUUUEEEE if for every key-value pair in self, there is a corresponding key in hhhhdddd that iiiissssEEEEqqqquuuuaaaallll. Their corresponding values must also be equal. NNNNooootttteeee: If you inherit from RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy in the presence of the Standard C++ Library, we recommend that you override this PPPPaaaaggggeeee 1111 RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) operator and explicitly forward the call. Overload resolution in C++ will choose the Standard Library provided global operators over inherited class members. These global definitions are not appropriate for set-like partial orderings. RWBoolean ooooppppeeeerrrraaaattttoooorrrr========(const RWHashDictionary& hd) const; Returns TTTTRRRRUUUUEEEE if self and hhhhdddd have the same number of entries and if for every key-value pair in self, there is a corresponding key in hhhhdddd that iiiissssEEEEqqqquuuuaaaallll. Their corresponding values must also be equal. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss void aaaappppppppllllyyyyTTTTooooKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWapplyKeyAndValue ap, void* x); Applies the user-supplied function pointed to by aaaapppp to each key-value pair of the collection. Items are not visited in any particular order. An untyped argument may be passed to the aaaapppp function through xxxx. RWBinaryTree aaaassssBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee(); RWBag aaaassssBBBBaaaagggg() const; RWSet aaaassssOOOOrrrrddddeeeerrrreeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const; aaaassssSSSSeeeetttt() const; RWOrdered RWBinaryTree aaaassssSSSSoooorrrrtttteeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const; Converts the RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy to an RRRRWWWWBBBBaaaagggg, RRRRWWWWSSSSeeeetttt, RRRRWWWWOOOOrrrrddddeeeerrrreeeedddd, or an RRRRWWWWBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee. Note that since a dictionary contains pairs of keys and values, the result of this call will be a container holding RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnnssss. Note also that the return value is a ccccooooppppyyyy of the data. This can be very expensive for large collections. Consider using ooooppppeeeerrrraaaattttoooorrrr++++====(((()))) to insert each RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnn from this dictionary into a collection of your choice. virtual RWspace bbbbiiiinnnnaaaarrrryyyySSSSttttoooorrrreeeeSSSSiiiizzzzeeee() const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. virtual void cccclllleeeeaaaarrrr(); PPPPaaaaggggeeee 2222 RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes all key-value pairs in the collection. virtual void cccclllleeeeaaaarrrrAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy(); Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes all key-value pairs in the collection, and deletes the key aaaannnndddd the value. virtual int ccccoooommmmppppaaaarrrreeeeTTTToooo(const RWCollectable* a) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. virtual RWBoolean ccccoooonnnnttttaaaaiiiinnnnssss(const RWCollectable* target) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. virtual size_t eeeennnnttttrrrriiiieeeessss() const; Inherited from class RRRRWWWWSSSSeeeetttt. virtual RWCollectable* ffffiiiinnnndddd(const RWCollectable* target) const; Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Returns the kkkkeeeeyyyy which iiiissssEEEEqqqquuuuaaaallll to the object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found. RWCollectable* ffffiiiinnnnddddKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target, RWCollectable*& v) const; Returns the key which iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found. The value is put in vvvv. You are responsible for defining vvvv before calling this function. RWCollectable* ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target) const; Returns the vvvvaaaalllluuuueeee associated with the key which iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found. PPPPaaaaggggeeee 3333 RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RWCollectable* ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target, RWCollectable* newValue); Returns the vvvvaaaalllluuuueeee associated with the key which iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found. Replaces the value with nnnneeeewwwwVVVVaaaalllluuuueeee (if a key was found). virtual unsigned hhhhaaaasssshhhh() const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. RWCollectable* iiiinnnnsssseeeerrrrttttKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWCollectable* key,RWCollectable* value); Adds a key-value pair to the collection and returns the key if successful, nnnniiiillll if the key is already in the collection. virtual RWClassID iiiissssAAAA() const; Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee to return ________RRRRWWWWHHHHAAAASSSSHHHHDDDDIIIICCCCTTTTIIIIOOOONNNNAAAARRRRYYYY. virtual RWBoolean iiiissssEEEEmmmmppppttttyyyy() const; Inherited from class RRRRWWWWSSSSeeeetttt. virtual RWBoolean iiiissssEEEEqqqquuuuaaaallll(const RWCollectable* a) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. virtual size_t ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(const RWCollectable* target) const; Inherited from class RRRRWWWWSSSSeeeetttt. Returns the number of keys which iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt. Because duplicates are not allowed, this function can only return 0 or 1. virtual RWCollectable* rrrreeeemmmmoooovvvveeee(const RWCollectable* target); PPPPaaaaggggeeee 4444 RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes the key and value pair where the key iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt. Returns the key, or nnnniiiillll if no match was found. virtual void rrrreeeemmmmoooovvvveeeeAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy(const RWCollectable* target); Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes aaaannnndddd deletes the key and value pair where the key iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt. Note that both the key and the value are deleted. Does nothing if the key is not found. RWCollectable* rrrreeeemmmmoooovvvveeeeKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target, RWCollectable*& v); Removes the key and value pair where the key iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt. Returns the key, or nnnniiiillll if no match was found. The value part of the removed pair is put in vvvv. You are responsible for defining vvvv before calling this function. void rrrreeeessssiiiizzzzeeee(size_t n = 0); Inherited from class RRRRWWWWSSSSeeeetttt. virtual void rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWvistream&); virtual void rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWFile&); virtual void ssssaaaavvvveeeeGGGGuuuuttttssss(RWvostream&) const; virtual void ssssaaaavvvveeeeGGGGuuuuttttssss(RWFile&) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. virtual RWCollection* sssseeeelllleeeecccctttt(RWtestCollectable testfunc, void* x) const; Evaluates the function pointed to by ttttsssstttt for the key of each item in the RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy. It inserts keys and values for which the function returns TTTTRRRRUUUUEEEE into a new RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated off the heap and returns a pointer to this new collection. Because the new dictionary is allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for deleting it when done. This is a vvvviiiirrrrttttuuuuaaaallll function which hides the non-virtual function inherited from RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. PPPPaaaaggggeeee 5555 RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) virtual RWCollection* sssseeeelllleeeecccctttt(RWtestCollectablePair testfunc, void* x) const; Evaluates the function pointed to by ttttsssstttt for both the key and the value of each item in the RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy. It inserts keys and values for which the function returns TTTTRRRRUUUUEEEE into a new RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated off the heap and returns a pointer to this new collection. Because the new dictionary is allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for deleting it when done. This is a vvvviiiirrrrttttuuuuaaaallll function which hides the non-virtual function inherited from RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. RWStringID ssssttttrrrriiiinnnnggggIIIIDDDD(); (acts virtual) Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. PPPPaaaaggggeeee 6666